<template>
  <div class="order">
    <van-notice-bar
      left-icon="volume-o"
      text="因疫情影响，部分地区无法配送公告"
    />
    <div class="line"></div>
    <!-- 地址信息 -->
    <div
      class="addressInfo"
      v-for="userAddress in userAddressList"
      :key="userAddress.id"
    >
      <div class="info">
        <div class="left">
          <p class="name">{{ userAddress.consignee }}</p>
          <span class="default" v-show="userAddress.isDefault === '1'"
            >默认</span
          >
        </div>
        <div class="middle">
          <p class="phone">{{ userAddress.phoneNum }}</p>
          <p class="addr">{{ userAddress.fullAddress }}</p>
        </div>
      </div>
      <van-icon name="arrow" size="18px" @click="toAddrList" />
    </div>
    <!-- 优惠券 -->
    <div class="coupon">
      <van-list>
        <van-cell>
          <div class="left" style="padding-right: 160px">暂无可用优惠券</div>
          <div>0张</div>
          <van-icon name="arrow" size="18px" />
        </van-cell>
        <van-cell>
          <van-radio name="1" v-model="radio1" disabled shape="square"
            >礼品卡余额：￥0.00</van-radio
          >
          <van-icon name="arrow" size="18px" />
        </van-cell>
        <van-cell>
          <van-radio name="1" v-model="radio1" disabled shape="square"
            >余额：￥0.00</van-radio
          >
          <van-icon name="info-o" size="18px" />
        </van-cell>
      </van-list>
    </div>
    <!-- 商品合计 -->
    <div class="total">
      <van-list>
        <van-cell>
          <div>商品合计</div>
          <div>￥{{ tradeInfo.totalAmount }}</div>
        </van-cell>
        <van-cell>
          <div>邮费</div>
          <div>￥0.00</div>
        </van-cell>
        <van-cell>
          <div>
            活动优惠
            <van-icon name="info-o" size="18px" />
          </div>
          <div>-￥0.00</div>
        </van-cell>
        <van-cell>
          <div>优惠券</div>
          <div>￥0.00</div>
        </van-cell>
        <van-cell>
          <van-radio
            name="1"
            v-model="radio3"
            shape="square"
            checked-color="#666"
            >我要开发票</van-radio
          >
          <van-icon name="arrow" size="18px" />
        </van-cell>
      </van-list>
    </div>
    <!-- 商品列表 -->
    <div
      class="package"
      v-for="detail in tradeInfo.detailArrayList"
      :key="detail.skuId"
    >
      <van-list>
        <van-cell>
          <div>包裹1</div>
          <div>18:00前支付，预计2月17日送达</div>
        </van-cell>
        <van-cell>
          <van-card
            :num="detail.skuNum"
            :price="detail.orderPrice"
            :title="detail.skuName"
            :thumb="detail.imgUrl"
          />
        </van-cell>
      </van-list>
    </div>
    <van-radio
      v-model="radio"
      class="argee"
      shape="square"
      icon-size="18px"
      checked-color="#666"
      >我已同意<a href="">《网易严选服务协议》</a>
    </van-radio>

    <van-submit-bar
      label="应付："
      :price="tradeInfo.totalAmount*100"
      button-text="提交订单"
      @click.native="toPay"
    />
  </div>
</template>

<script>
//import { reqUserAddressList, reqTradeInfo, reqSubmitOrder } from "@/api";
export default {
  data() {
    return {
      radio: "1",
      radio1: "1",
      radio2: "1",
      radio3: "0",
      loading: false,
      finished: false,
      userAddressList: [
        {
          id: "07",
          consignee: "雪碧",
          phoneNum: "15011111111",
          fullAddress: "北京市昌平区2",
          isDefault: "1",
        },
      ], //收货地址
      tradeInfo: {
        totalAmount:13029.00,
        detailArrayList: [
          {
            id: null,
            orderId: null,
            skuId: 6,
            skuName: " Apple iPhone 11 (A2223) 128GB 蓝色 移动联通电信22",
            imgUrl:
              "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.mydrivers.com%2Fimg%2F20211011%2FSf0708c9e-81fe-4680-86c5-161cc316fb23.jpg&refer=http%3A%2F%2Fimg1.mydrivers.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1647570422&t=f4819e512b85cf17e259946e4ae883a6",
            orderPrice: 4343,
            skuNum: 2,
            hasStock: null,
          },
          {
            id: null,
            orderId: null,
            skuId: 8,
            skuName: " Apple iPhone 11 (A2223) 128GB 蓝色 移动联通电信22",
            imgUrl:
              "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.mydrivers.com%2Fimg%2F20211011%2FSf0708c9e-81fe-4680-86c5-161cc316fb23.jpg&refer=http%3A%2F%2Fimg1.mydrivers.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1647570422&t=f4819e512b85cf17e259946e4ae883a6",
            orderPrice: 4343,
            skuNum: 1,
            hasStock: null,
          },
        ],
      }, //交易信息
    };
  },
  methods: {
    //点击跳转地址列表
    toAddrList() {
      this.$router.push({
        path: "/AddressList",
      });
    },
    //点击跳转支付列表
    toPay() {
      this.$router.push({
        path: "/Pay",
      });
    },
  }
};
</script>

<style lang="less">
.order {
  height: 100%;
  padding-bottom: 50px;
  background-color: #eee;
  .line {
    width: 100%;
    height: 5px;
    margin-top: 10px;
    background-image: url(~@/pages/Order/images/line.png);
    background-size: 30px;
    background-repeat: repeat-x;
  }
  .addressInfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    margin-bottom: 10px 0;
    padding: 20px 15px;
    .info {
      display: flex;
      .left {
        width: 60px;
        p {
          margin: 3px;
        }
        .default {
          font-size: 12px;
          color: #dd1a21;
          margin-left: 3px;
          border-radius: 3px;
          border: 2px solid #dd1a21;
        }
      }
      .middle {
        width: 260px;
        p {
          margin: 3px;
        }
        .addr {
          color: #666;
          font-size: 12px;
        }
      }
    }
  }
  .coupon {
    margin-top: 10px;
    .van-list {
      .van-cell__value--alone {
        margin: 5px 3px;
        display: flex;
        justify-content: space-between;
      }
    }
  }
  .total {
    margin-top: 10px;
    .van-list {
      .van-cell__value--alone {
        margin: 5px 3px;
        display: flex;
        justify-content: space-between;
      }
    }
  }
  .package {
    margin-top: 10px;
    .van-list {
      .van-cell__value--alone {
        display: flex;
        justify-content: space-between;
      }
    }
  }
  .argee {
    margin: 10px;
    font-size: 12px;
  }
  .van-submit-bar__bar {
    padding: 0 0 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    .van-submit-bar__text {
      color: #dd1a21;
      font-size: 16px;
      text-align: left;
    }
    .van-submit-bar__price {
      font-size: 16px;
    }
    .van-submit-bar__button--danger {
      border-radius: 0px;
      background: #dd1a21;
      padding: 25px;
    }
  }
}
</style>